<!--
 * @Author: wangming
 * @Date: 2021-04-01 14:02:25
 * @LastEditors: wangming
 * @LastEditTime: 2022-01-28 11:04:52
 * @Description: file content
-->
<template>
  <el-form-item
    v-if="showDefaultRegFields.includes(value.tagName)"
    label="默认值"
    prop="defaultValue"
  >
    <template slot="label">
      默认值
      <el-tooltip
        popper-class="custom-popper"
        effect="dark"
        content="示例:[id]或者[id1][id2]"
        placement="top-start"
      >
        <i style="position: relative; z-index: 1" class="el-icon-question" />
      </el-tooltip>
    </template>
    <el-input
      v-model="value.defaultValue"
      size="small"
      placeholder="请输入"
    ></el-input>
  </el-form-item>
  <el-form-item
    v-else-if="value.tagName === 'hlColorPicker'"
    label="默认值"
    prop="defaultValue"
  >
    <el-color-picker
      key="rgba"
      v-if="value.__config.rgbType === 'rgba'"
      v-model="value.defaultValue"
      :predefine="predefineColors"
      :show-alpha="true"
    ></el-color-picker>
    <el-color-picker
      v-else
      key="rgb"
      v-model="value.defaultValue"
      :predefine="predefineColors"
    ></el-color-picker>
  </el-form-item>
  <el-form-item v-else label="默认值" prop="defaultValue">
    <el-input
      :maxlength="value.__config.maxlength || 99999999999"
      v-model="value.defaultValue"
      size="small"
      placeholder="请输入"
    ></el-input>
  </el-form-item>
</template>

<script>
import basicmixins from "./basicmixins";
import { PREDEFINE_COLORS } from "@/utils/const";

export default {
  mixins: [basicmixins],
  data() {
    return {
      showDefaultRegFields: ["hlRadio", "hlSelect", "hlCheckbox"],
      predefineColors: PREDEFINE_COLORS,
    };
  },
  methods: {},
};
</script>

<style lang="scss" scoped></style>
